package com.hy.controller;

import com.hy.domain.dto.R;
import com.hy.service.BlogFollowService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("follow")
public class FollowController {

    @Autowired
    private BlogFollowService followService;

    @GetMapping("/{id}")
    public R isFollow(@PathVariable Long id) {
        boolean isFollow = followService.isFollow(id);
        return R.ok(isFollow);
    }

    @PostMapping
    public R follow(@Param("followId") Long followId, @Param("isFollow") Boolean isFollow) {
        boolean result = followService.follow(followId, isFollow);
        return R.ok(result);
    }
}
